package cn.jinshengda.controller;


import cn.jinshengda.entity.Project;
import cn.jinshengda.service.ProjectService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-01-08
 */
@RestController
@CrossOrigin
@RequestMapping("/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @GetMapping("empId")
    public Project queryByEmpId(Integer id){
        QueryWrapper<Project> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("employee_id", id);
        Project project = projectService.getOne(queryWrapper);
        return project;
    }

    @GetMapping("id")
    public Project queryById(Integer id){
        Project project = projectService.getById(id);
        return project;
    }


}

